from jsonrpc import JSONRPCResponseManager, dispatcher
from werkzeug.wrappers import Request, Response


# 回显字符串
@dispatcher.add_method
def echo(s):
    return s


# 主体
@Request.application
def application(request):
    response = JSONRPCResponseManager.handle(request.data, dispatcher)
    return Response(response.json, mimetype='application/json')
